<template>
	<view>
	    <button @click="get">按钮</button>
		<view v-for="(item,index) in list" :key="index">
			{{item}}
		</view>
		<button @click="uploadImg">上传图片</button>
		<image v-for="item in imgArr" :src="item" @click="previewImg(item)"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [
					'前端', 'JAVA', '测试', '大数据'
				],
				imgArr:[]
			}
		},
		onPullDownRefresh() {
			console.log("触发下拉刷新")
			setTimeout(()=>{
				this.list=['后端', 'UI', '产品', 'ELK']
				uni.stopPullDownRefresh()
			},1000)
		},
		methods: {
			get(){
				uni.request({
					url: "http://localhost:8082/api/getlunbo",
					success(res) {
						console.log(res)
					}
				})
			},
			uploadImg() {
				var that = this;
				uni.chooseImage({
					count:5,
					success(res) {
						console.log(res)
						that.imgArr = res.tempFilePaths
					}
				})
			},
			previewImg(current) {
				console.log(current)
				uni.previewImage({
					current:current,
					urls:this.imgArr,
					loop:true,
					indicator: "number"
				})
			}
		}
	}
</script>

<style>

</style>
